
	<% for question in  survey.questions %>
	
	<% survey_form.fields_for :questions,question do  |question_from|%>
	<div class="question">
                        <br/>
                        <hr/>
			<%= question_from.hidden_field :typeID, :value =>question.questiontype.id %>		
 				
			<% if  question.questiontype.name=="closed question" %>	
				<fieldset style="border: none; padding-left: 0px;">
				Pytanie zamknięte:<BR/>
		  		<p>
		  			<label for="question_question">Treść pytania</label>	
		  				<%= question_from.text_field :question, :size => 40 %>	
	  			</p>
				<% 	question_from.fields_for :closedquestion,question.closedquestion do |cqform| %>
 				
 					<p>
					<label for="question_question">Min zaznaczonych odp</label>	
					<%= cqform.text_field  :minAnswers %><br/>
	 				</p>
	 				
	 				<p>
					<label for="question_question">Max zaznaczonych odp</label>	
					<%= cqform.text_field  :maxAnswers %><br/>
					</p>	
	
						
	 					<% for answer in  question.closedquestion.cqpossibleanswers %>
	
			 				<% 	cqform.fields_for :cqpossibleanswers,answer do |cqpaform| %>
			      		
						   		<p>
									<%= cqpaform.text_field  :possibleAnswer %>
								
								</p>
							
						   <% end %>
						
						   
					   <% end %>
                                           
					   <%= add_possible_answer_link %> 
                                           <br/><br/>
					   
				<% end %>
				
				</fieldset>
				<%= remove_cq_question_link( question_from ) %>
			<% end %>
			
			<% if  question.questiontype.name=="open question" %>	
				Pytanie otwarte:<BR/>
				<p>
		  		<label for="question_question">Treść pytania</label>	
		  			<%= question_from.text_field :question, :size => 40 %>	
	  			</p>
	  			
	  			<%= remove_oq_question_link( question_from ) %>
			<% end %>
		
	</div>		
	<% end %>
	
	<% end %>